<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>我的人脉</title>
	<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
	<meta content="yes" name="apple-mobile-web-app-capable"/>
	<meta content="black" name="apple-mobile-web-app-status-bar-style"/>
	<meta content="telephone=no" name="format-detection"/>
	<link type="text/css" rel="stylesheet" href="../themes/css/base.css">
	<link type="text/css" rel="stylesheet" href="../themes/css/home.css">
	<link type="text/css" rel="stylesheet" href="../themes/css/icon.css">
	<link rel="icon" type="image/x-icon" href="../favicon.ico">
</head>
<body>

	<header class="aui-navBar aui-navBar-fixed b-line">
		<a href="javascript:history.go(-1);" class="aui-navBar-item">
			<i class="icon icon-return"></i>
		</a>
		<div class="aui-center">
			<span class="aui-center-title">我的人脉</span>
		</div>
		<a href="javascript:;" class="aui-navBar-item">
			<i class="icon icon-sys"></i>
		</a>
	</header>

		<div class="aui-team-box">
			<div class="aui-team-head">
				<h1 id="countNum"></h1>
				<h2>我的人脉总数</h2>
			</div>
		</div>
		<!--<div class="aui-fold-box">-->
			<!--<h3 class="Collapsing  current b-line">人脉列表</h3>-->
			<div class="coll_body" style="display: block;" id="teamls">
			</div>
			<span id="team"></span>
	<span id="indexNum"  style="display:none;">1</span>
	<span id="flagls"  style="display:none;">Y</span>
		<!--</div>-->




</body>
<script type="text/javascript" src="/carworld_weixin/themes/js/jquery.min.js"></script>
<script type="text/javascript" src="/carworld_weixin/themes/js/slider.js"></script>
<script type="text/javascript" src="/carworld_weixin/themes/js/layer.js"></script>
<script type="text/javascript">


	
    $(document).ready(function() {
        init();

        // 设置布尔值用于判断是否该DIV到达过可视区域
        // 监听滚轮事件
        $(window).scroll(function() {
            var   viewH =$(this).height();//可见高度
            var   contentH =$("#teamls").height()-viewH;//内容高度
            var   scrollTop =$(this).scrollTop();//滚动高度
            if ("Y" == $("#flagls").text()) {
                // 判断
                // $(window).scrollTop()为返回滚动条的垂直位置
                // $(window).height()代表了当前可见区域的大小,即你看到的浏览器显示范围
                if (scrollTop>contentH ) {
                    // 如果到达了可视区域，则设置其布尔值为false，防止一直调用下面函数，即只做一次ajax请求
                    $("#flagls").text("N");
                    // 你的ajax请求函数
                    loaddata();
                }
            }
        })

        function loaddata() {
            var index=$("#indexNum").text();
            $.ajax({
                async:false,
                url: "/carworld_weixin/vipcard/getMyCardPeople2",
                dataType: "json",
                data:{"indexNum":index},
                success:function (data) {
                    $.each(data.cardTeamLs, function(index, elem) {
                        if(elem[0]!=null && elem[0]!=undefined && elem[0]!=""){
                            var state=elem[0];
                        }else {
                            var state="../themes/img/user/user-logo-004.png";
                        }
                        var head='<div class="aui-flex b-line"><div class="aui-member-user">\n' +
                            '<img src="'+state+'" alt=""></div>\n' +
                            '<div class="aui-flex-box"><h3>'+elem[1]+' </h3><p>绑定时间:'+elem[2]+'</p></div><div class="aui-flex-box"><h4>累计提供收益:\'+elem[3]+\'</h4><p>&nbsp;</p></div></div>'
                        $('#teamls').append(head);
                        $("#indexNum").text(data.indexNum);
                        $("#flagls").text("Y");
                    });

                }
            });

        }

    });

    function init() {
        $.ajax({
            url: "/carworld_weixin/vipcard/getMyCardPeople",
            success:function (data) {
                console.log(data);
                $('#countNum').append(data.countNum);
                var count=data.cardTeamLs.length;
                if(0==count){
                    $('#team').append('<div style=";text-align:center;font-size:14px;color:#bbb;">您还没有人脉哦,欢迎分享给好友~</div>');
                }else{
                    $.each(data.cardTeamLs, function(index, elem) {
                        if(elem[0]!=null && elem[0]!=undefined && elem[0]!=""){
                            var state=elem[0];
						}else {
                            var state="../themes/img/user/user-logo-004.png";
						}
                        var head='<div class="aui-flex b-line"><div class="aui-member-user">\n' +
                            '<img src="'+state+'" alt=""></div>\n' +
                            '<div class="aui-flex-box"><h3>'+elem[1]+' </h3><p>绑定时间:'+elem[2]+'</p></div><div class="aui-flex-box"><h4>累计提供收益:'+elem[3]+'</h4><p>&nbsp;</p></div></div>'
                        $('#teamls').append(head);
                    });
				}
            }
        });
    }
</script>
</html>
